package com.ad.pet.ui;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.utils.LyxUtils;

/**
 * Created by SEELE on 2019/6/3.
 */

public class OpenRedBagDialog extends Dialog {



    private View mView;


    public OpenRedBagDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);

        initView(context);
    }

    private void initView(Context context) {

        mView = View.inflate(context, R.layout.layout_open_redbag_dialog,null);

        ImageView ivBg = mView.findViewById(R.id.iv_bg);
        GlideUtil.loadNoDefault(context,LyxUtils.getImgUrl(R.drawable.ic_open_redbag_end),ivBg);


        setContentView(mView);



        Window window = this.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
//        lp.width = (screenWidth *  8/ 10); // 设置宽度
        lp.height = LyxUtils.dp2px(getContext(),430);
        this.getWindow().setAttributes(lp);
        window.setGravity(Gravity.CENTER);
    }


    public View getView(){
        return mView;
    }
}
